package cj.web.marry.controllers;

import net.paoding.rose.web.annotation.Param;
import net.paoding.rose.web.annotation.Path;
import net.paoding.rose.web.annotation.rest.Get;
import net.paoding.rose.web.var.Model;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import cj.utils.Constants;
import cj.utils.weixin.HttpsWenXinUtil;
import cj.web.marriage.constants.MarriageRegTypeEnum;

@Path("notes")
public class NotesController {
	
	protected static final Log logger = LogFactory.getLog(NotesController.class); 
	
	//结婚预约须知Code
	@Get("marryNotesCode")
	public String marryNotesCode(Model model,@Param("code")String code)
	{
		String openId = HttpsWenXinUtil.retOpenId(code,Constants.weixinkey.AppID,Constants.weixinkey.AppSecret);
		model.add("openId", openId);
		return "r:marryNotes?openId="+openId;
	}
	
	//结婚预约须知
	@Get("marryNotes")
	public String marryNotes(Model model,@Param("openId")String openId)
	{
		model.add("openId", openId);
		model.add("type", MarriageRegTypeEnum.jiehunyy.getValue());
		return "/views/marry/marryNotes.vm";
	}
	
	//结婚预约须知-more
	@Get("marryNotesMore")
	public String marryNotesMore(Model model,@Param("openId")String openId)
	{
		model.add("openId", openId);
		model.add("type", MarriageRegTypeEnum.jiehunyy.getValue());
		return "/views/marry/marryNotesMore.vm";
	}
	
	
	//其他预约须知Code
	@Get("otherNotesCode")
	public String otherNotesCode(Model model,@Param("code")String code)
	{
		String openId = HttpsWenXinUtil.retOpenId(code,Constants.weixinkey.AppID,Constants.weixinkey.AppSecret);
		model.add("openId", openId);
		return "r:otherNotes?openId="+openId;
	}
	
	//其他预约须知
	@Get("otherNotes")
	public String otherNotes(Model model,@Param("openId")String openId)
	{
		model.add("openId", openId);
		model.add("type", MarriageRegTypeEnum.buzhengyy.getValue());
		return "/views/marry/otherNotes.vm";
	}
	
	
	//补证预约须知Code
	@Get("buzhengNotesCode")
	public String buzhengNotesCode(Model model,@Param("code")String code)
	{
		String openId = HttpsWenXinUtil.retOpenId(code,Constants.weixinkey.AppID,Constants.weixinkey.AppSecret);
		model.add("openId", openId);
		return "r:buzhengNotes?openId="+openId;
	}
	
	//补证预约须知
	@Get("buzhengNotes")
	public String buzhengNotes(Model model,@Param("openId")String openId)
	{
		model.add("openId", openId);
		model.add("type", MarriageRegTypeEnum.buzhengyy.getValue());
		return "/views/marry/buzhengNotes.vm";
	}
	
	//补证预约须知-more
	@Get("buzhengNotesMore")
	public String buzhengNotesMore(Model model,@Param("openId")String openId)
	{
		model.add("openId", openId);
		model.add("type", MarriageRegTypeEnum.buzhengyy.getValue());
		return "/views/marry/buzhengNotesMore.vm";
	}
	
	//离婚预约须知Code
	@Get("lihunNotesCode")
	public String lihunNotesCode(Model model,@Param("code")String code)
	{
		String openId = HttpsWenXinUtil.retOpenId(code,Constants.weixinkey.AppID,Constants.weixinkey.AppSecret);
		model.add("openId", openId);
		return "r:lihunNotes?openId="+openId;
	}
	
	//离婚预约须知
	@Get("lihunNotes")
	public String lihunNotes(Model model,@Param("openId")String openId)
	{
		model.add("openId", openId);
		model.add("type", MarriageRegTypeEnum.lihunyy.getValue());
		return "/views/marry/lihunNotes.vm";
	}
	
	//离婚预约须知-more
	@Get("lihunNotesMore")
	public String lihunNotesMore(Model model,@Param("openId")String openId)
	{
		model.add("openId", openId);
		model.add("type", MarriageRegTypeEnum.lihunyy.getValue());
		return "/views/marry/lihunNotesMore.vm";
	}
	
	//离婚预约须知Code
	@Get("tesheNotesCode")
	public String tesheNotesCode(Model model,@Param("code")String code)
	{
		String openId = HttpsWenXinUtil.retOpenId(code,Constants.weixinkey.AppID,Constants.weixinkey.AppSecret);
		model.add("openId", openId);
		return "r:tesheNotes?openId="+openId;
	}
	
	//特色颁证预约须知
	@Get("tesheNotes")
	public String tesheNotes(Model model,@Param("openId")String openId)
	{
		model.add("openId", openId);
		return "/views/marry/tesheNotes.vm";
	}
	
	//我要预约
	@Get("myBespeak")
	public String myBespeak(Model model,@Param("code")String code)
	{
		String openId = HttpsWenXinUtil.retOpenId(code,Constants.weixinkey.AppID,Constants.weixinkey.AppSecret);
		model.add("openId", openId);
		return "r:/reg/ceremony?openId="+openId;
	}
	
	//给长江网授权的接口
	@Get("cjwCode")
	public String cjwCode(Model model,@Param("code")String code)
	{
		String openId = HttpsWenXinUtil.retOpenId(code,Constants.weixinkey.AppID,Constants.weixinkey.AppSecret);
		model.add("openId", openId);
		return "r:http://marriagewx.cjrbjt.com/Public/index.php?s=wechat/oauthCallback&openid="+openId;
	}
}
